package com.zqwzd.util;

import java.util.UUID;

/**
 * 随机码工具类
 * 
 * @author BOBO
 * @date 2013-03-21
 *
 */
public class RandomTools {
	
	/**
	 * 返回一个随机码.长度36
	 * 
	 * @return
	 * @see RandomTools#randomStringByUUID()
	 */
	public static String randomString(){
		return randomStringByUUID();
	}
	
	/**
	 * 生成一个随机码,长度36,全大写.
	 * 
	 * @return
	 */
	public static String randomStringUpper(){
		return randomString().toUpperCase();
	}
	
	/**
	 * 使用java5的UUID类,返回一个随机码,长度36
	 * 
	 * @return 一个随机码,形如:5ec24ed3-ff1a-41c1-8d23-a37af006bbb3
	 */
	private static String randomStringByUUID(){
		return UUID.randomUUID().toString();
	}
	
	public static void main(String[] args) {
//		System.out.println(randomString());
		System.out.println(randomStringUpper());
	}
}
